﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Enter.Entity;
using Enter.BizLogic;
using Enter.Config;
using System.Data;

namespace Enter.Services.Mail
{
    public partial class Mail : IMail
    {
        /// <summary>
        /// 商品编码
        /// </summary>
        /// <returns></returns>
        public string GetProductNo()
        {
            int num = new Random().Next(100, 0x270f);
            return "p" + "-" + DateTime.Now.ToString("MMddHHmmss") + DateTime.Now.Millisecond.ToString() + "-" + num.ToString();

        }
        /// <summary>
        /// 添加商品
        /// </summary>
        /// <param name="Entity"></param>
        /// <param name="itemList">库存</param>
        /// <param name="imgList">图片</param>
        /// <param name="propertyList">属性</param>
        /// <returns></returns>
        public bool AddProduct(T101_GoodsEntity Entity, List<T103_Goods_ItemEntity> itemList, List<T104_GoodImgesEntity> imgList, List<T113_Good_PropertyEntity> propertyList)
        {
            T101_GoodsBLLSub bll = new T101_GoodsBLLSub();
           return bll.Save(Entity, itemList, imgList, propertyList);
        }

        public T101_GoodsEntity GetProduct(int ID)
        {
            T101_GoodsBLLSub bll = new T101_GoodsBLLSub();
            return bll.GetObjectByGID(ID);
        }
        #region 商品列表
        #region 热评
        /// <summary>
        /// 根据地区获取热评商品
        /// </summary>
        /// <param name="areaNO">地区</param>
        /// <param name="count">数量</param>
        /// <returns>T101_GoodsEntity结果集</returns>
        public List<T101_GoodsEntity> GetCommentGoods(int count)
        {
            T101_GoodsBLLSub bll = new T101_GoodsBLLSub();
            return bll.GetCommentGoods("", count);
        }
        /// <summary>
        /// 某店铺热评商品
        /// </summary>
        /// <param name="shopID">店铺</param>
        /// <param name="count">数量</param>
        /// <returns>T101_GoodsEntity结果集</returns>
        public List<T101_GoodsEntity> GetCommentGoodsbyShop(string shopNo, int count)
        {
            T101_GoodsBLLSub bll = new T101_GoodsBLLSub();
            return bll.GetCommentGoodsbyShop(shopNo, count);
        }
        /// <summary>
        /// 获取某类型热评商品
        /// </summary>
        /// <param name="areaNO">地区</param>
        /// <param name="classID">类型</param>
        /// <param name="count">数量</param>
        /// <returns>T101_GoodsEntity结果集</returns>
        public List<T101_GoodsEntity> GetCommentGoodsbyCID(string areaNO, string classNO, int count)
        {
            T101_GoodsBLLSub bll = new T101_GoodsBLLSub();
            return bll.GetCommentGoodsbyCID(areaNO, classNO, count);
        }
        /// <summary>
        /// 根据店铺、类型获取热评商品
        /// </summary>
        /// <param name="shopID">店铺</param>
        /// <param name="classID">类型</param>
        /// <param name="count">数量</param>
        /// <returns>T101_GoodsEntity结果集</returns>
        public List<T101_GoodsEntity> GetCommentGoodsbyCID(int shopID, string classNO, int count)
        {
            T101_GoodsBLLSub bll = new T101_GoodsBLLSub();
            return bll.GetCommentGoodsbyCID(shopID, classNO, count);
        }
        /// <summary>
        /// 根据地区、父类型获取热评商品
        /// </summary>
        /// <param name="areaNO">地区</param>
        /// <param name="classID">父类型</param>
        /// <param name="count">数量</param>
        /// <returns>T101_GoodsEntity结果集</returns>
        public List<T101_GoodsEntity> GetCommentGoodsbyFClass(string areaNO, string classNO, int count)
        {
            T101_GoodsBLLSub bll = new T101_GoodsBLLSub();
            return bll.GetCommentGoodsbyFClass(areaNO, classNO, count);
        }
        /// <summary>
        /// 根据店铺、父类型获取热评商品
        /// </summary>
        /// <param name="shopID">店铺</param>
        /// <param name="classID">父类型</param>
        /// <param name="count">数量</param>
        /// <returns>T101_GoodsEntity结果集</returns>
        public List<T101_GoodsEntity> GetCommentGoodsbyFClass(int shopID, string classNO, int count)
        {
            T101_GoodsBLLSub bll = new T101_GoodsBLLSub();
            return bll.GetCommentGoodsbyFClass(shopID, classNO, count);
        }
        #endregion

        #region  热卖

        /// <summary>
        /// 根据地区获取热卖商品
        /// </summary>
        /// <param name="areaNO">地区</param>
        /// <param name="count">数量</param>
        /// <returns>T101_GoodsEntity结果集</returns>
        public List<T101_GoodsEntity> GetHotGoods(string areaNO, int count)
        {
            T101_GoodsBLLSub bll = new T101_GoodsBLLSub();
            return bll.GetHotGoods(areaNO, count);
        }
        /// <summary>
        /// 某店铺热卖商品
        /// </summary>
        /// <param name="shopID">店铺</param>
        /// <param name="count">数量</param>
        /// <returns>T101_GoodsEntity结果集</returns>
        public List<T101_GoodsEntity> GetHotGoodsbyShop(string shopNo, int count)
        {
            T101_GoodsBLLSub bll = new T101_GoodsBLLSub();
            return bll.GetHotGoodsbyShop(shopNo, count);
        }
        /// <summary>
        /// 获取某类型热卖商品
        /// </summary>
        /// <param name="areaNO">地区</param>
        /// <param name="classID">类型</param>
        /// <param name="count">数量</param>
        /// <returns>T101_GoodsEntity结果集</returns>
        public List<T101_GoodsEntity> GetHotGoodsbyCID(string areaNO, string classNO, int count)
        {
            T101_GoodsBLLSub bll = new T101_GoodsBLLSub();
            return bll.GetHotGoodsbyCID(areaNO, classNO, count);
        }
        /// <summary>
        /// 根据店铺、类型获取热卖商品
        /// </summary>
        /// <param name="shopID">店铺</param>
        /// <param name="classID">类型</param>
        /// <param name="count">数量</param>
        /// <returns>T101_GoodsEntity结果集</returns>
        public List<T101_GoodsEntity> GetHotGoodsbyCID(int shopID, string classNO, int count)
        {
            T101_GoodsBLLSub bll = new T101_GoodsBLLSub();
            return bll.GetHotGoodsbyCID(shopID, classNO, count);
        }
        /// <summary>
        /// 根据地区、父类型获取热卖商品
        /// </summary>
        /// <param name="areaNO">地区</param>
        /// <param name="classID">父类型</param>
        /// <param name="count">数量</param>
        /// <returns>T101_GoodsEntity结果集</returns>
        public List<T101_GoodsEntity> GetHotGoodsbyFClass(string areaNO, string classNO, int count)
        {
            T101_GoodsBLLSub bll = new T101_GoodsBLLSub();
            return bll.GetHotGoodsbyFClass(areaNO, classNO, count);
        }
        /// <summary>
        /// 根据店铺、父类型获取热卖商品
        /// </summary>
        /// <param name="shopID">店铺</param>
        /// <param name="classID">父类型</param>
        /// <param name="count">数量</param>
        /// <returns>T101_GoodsEntity结果集</returns>
        public List<T101_GoodsEntity> GetHotGoodsbyFClass(int shopID, string classNO, int count)
        {
            T101_GoodsBLLSub bll = new T101_GoodsBLLSub();
            return bll.GetHotGoodsbyFClass(shopID, classNO, count);
        }

        #endregion


        #region 热门收藏
        /// <summary>
        /// 根据地区获取热门收藏商品
        /// </summary>
        /// <param name="areaNO">地区</param>
        /// <param name="count">数量</param>
        /// <returns>T101_GoodsEntity结果集</returns>
        public List<T101_GoodsEntity> GetCollectGoods(string areaNO, int count)
        {
            T101_GoodsBLLSub bll = new T101_GoodsBLLSub();
            return bll.GetCollectGoods(areaNO, count);
        }
        /// <summary>
        /// 某店铺热门收藏商品
        /// </summary>
        /// <param name="shopID">店铺</param>
        /// <param name="count">数量</param>
        /// <returns>T101_GoodsEntity结果集</returns>
        public List<T101_GoodsEntity> GetCollectGoodsbyShop(string shopNo, int count)
        {
            T101_GoodsBLLSub bll = new T101_GoodsBLLSub();
            return bll.GetCollectGoodsbyShop(shopNo, count);
        }
        /// <summary>
        /// 获取某类型热门收藏商品
        /// </summary>
        /// <param name="areaNO">地区</param>
        /// <param name="classID">类型</param>
        /// <param name="count">数量</param>
        /// <returns>T101_GoodsEntity结果集</returns>
        public List<T101_GoodsEntity> GetCollectGoodsbyCID(string areaNO, string classNO, int count)
        {
            T101_GoodsBLLSub bll = new T101_GoodsBLLSub();
            return bll.GetCollectGoodsbyCID(areaNO, classNO, count);
        }
        /// <summary>
        /// 根据店铺、类型获取热门收藏商品
        /// </summary>
        /// <param name="shopID">店铺</param>
        /// <param name="classID">类型</param>
        /// <param name="count">数量</param>
        /// <returns>T101_GoodsEntity结果集</returns>
        public List<T101_GoodsEntity> GetCollectGoodsbyCID(int shopID, string classNO, int count)
        {
            T101_GoodsBLLSub bll = new T101_GoodsBLLSub();
            return bll.GetCollectGoodsbyCID(shopID, classNO, count);
        }
        /// <summary>
        /// 根据地区、父类型获取热门收藏商品
        /// </summary>
        /// <param name="areaNO">地区</param>
        /// <param name="classID">父类型</param>
        /// <param name="count">数量</param>
        /// <returns>T101_GoodsEntity结果集</returns>
        public List<T101_GoodsEntity> GetCollectGoodsbyFClass(string areaNO, string classNO, int count)
        {
            T101_GoodsBLLSub bll = new T101_GoodsBLLSub();
            return bll.GetCollectGoodsbyFClass(areaNO, classNO, count);
        }
        /// <summary>
        /// 根据店铺、父类型获取热门收藏商品
        /// </summary>
        /// <param name="shopID">店铺</param>
        /// <param name="classID">父类型</param>
        /// <param name="count">数量</param>
        /// <returns>T101_GoodsEntity结果集</returns>
        public List<T101_GoodsEntity> GetCollectGoodsbyFClass(int shopID, string classNO, int count)
        {
            T101_GoodsBLLSub bll = new T101_GoodsBLLSub();
            return bll.GetCollectGoodsbyFClass(shopID, classNO, count);
        }
        #endregion

        #region  热门浏览

        /// <summary>
        /// 根据地区获取热门浏览商品
        /// </summary>
        /// <param name="areaNO">地区</param>
        /// <param name="count">数量</param>
        /// <returns>T101_GoodsEntity结果集</returns>
        public List<T101_GoodsEntity> GetHitGoods(string areaNO, int count)
        {
            T101_GoodsBLLSub bll = new T101_GoodsBLLSub();
            return bll.GetHitGoods(areaNO, count);
        }
        /// <summary>
        /// 某店铺热门浏览商品
        /// </summary>
        /// <param name="shopID">店铺</param>
        /// <param name="count">数量</param>
        /// <returns>T101_GoodsEntity结果集</returns>
        public List<T101_GoodsEntity> GetHitGoodsbyShop(string shopNo, int count)
        {
            T101_GoodsBLLSub bll = new T101_GoodsBLLSub();
            return bll.GetHitGoodsbyShop(shopNo, count);
        }
        /// <summary>
        /// 获取某类型热门浏览商品
        /// </summary>
        /// <param name="areaNO">地区</param>
        /// <param name="classID">类型</param>
        /// <param name="count">数量</param>
        /// <returns>T101_GoodsEntity结果集</returns>
        public List<T101_GoodsEntity> GetHitGoodsbyCID(string areaNO, string classNO, int count)
        {
            T101_GoodsBLLSub bll = new T101_GoodsBLLSub();
            return bll.GetHitGoodsbyCID(areaNO, classNO, count);
        }
        /// <summary>
        /// 根据店铺、类型获取热门浏览商品
        /// </summary>
        /// <param name="shopID">店铺</param>
        /// <param name="classID">类型</param>
        /// <param name="count">数量</param>
        /// <returns>T101_GoodsEntity结果集</returns>
        public List<T101_GoodsEntity> GetHitGoodsbyCID(int shopID, string classNO, int count)
        {
            T101_GoodsBLLSub bll = new T101_GoodsBLLSub();
            return bll.GetHitGoodsbyCID(shopID, classNO, count);
        }
        /// <summary>
        /// 根据地区、父类型获取热门浏览商品
        /// </summary>
        /// <param name="areaNO">地区</param>
        /// <param name="classID">父类型</param>
        /// <param name="count">数量</param>
        /// <returns>T101_GoodsEntity结果集</returns>
        public List<T101_GoodsEntity> GetHitGoodsbyFClass(string areaNO, string classNO, int count)
        {
            T101_GoodsBLLSub bll = new T101_GoodsBLLSub();
            return bll.GetHitGoodsbyFClass(areaNO, classNO, count);
        }
        /// <summary>
        /// 根据店铺、父类型获取热门浏览商品
        /// </summary>
        /// <param name="shopID">店铺</param>
        /// <param name="classID">父类型</param>
        /// <param name="count">数量</param>
        /// <returns>T101_GoodsEntity结果集</returns>
        public List<T101_GoodsEntity> GetHitGoodsbyFClass(int shopID, string classNO, int count)
        {
            T101_GoodsBLLSub bll = new T101_GoodsBLLSub();
            return bll.GetHitGoodsbyFClass(shopID, classNO, count);
        }

        #endregion

        #region 分页数据集
              /// <summary>
        /// 根据地区获取商品
        /// </summary>
        /// <param name="entity">排序实体</param>
        /// <param name="areaNo">地区</param>
        /// <param name="orderCol">排序字段</param>
        /// <param name="orderType">排序方式</param>
        /// <param name="totalPages">总页数</param>
        /// <param name="totalCount">总条数</param>
        /// <returns></returns>
        public DataTable GetGoods(string areaNo, int pageSize, int currentPageIndex, EnumGoodOrder orderCol, EnumOrderType orderType, out int totalPages, out int totalCount)
        {

            T101_GoodsBLLSub bll = new T101_GoodsBLLSub();
            return bll.GetGoods(areaNo, pageSize, currentPageIndex, orderCol, orderType, out totalPages, out totalCount);
        }
        /// <summary>
        /// 根据地区、商品类型获取商品
        /// </summary>
        /// <param name="entity">排序实体</param>
        /// <param name="areaNo">地区</param>
        /// <param name="classID">商品类型</param>
        /// <param name="orderCol">排序字段</param>
        /// <param name="orderType">排序方式</param>
        /// <param name="totalPages">总页数</param>
        /// <param name="totalCount">总条数</param>
        /// <returns></returns>
        public DataTable GetGoodsbyCID(string areaNo, string classNO,string propList,string SerachKey, decimal sprice, decimal eprice, int pageSize, int currentPageIndex, EnumGoodOrder orderCol, EnumOrderType orderType, out int totalPages, out int totalCount)
        {
            T101_GoodsBLLSub bll = new T101_GoodsBLLSub();
            return bll.GetGoodsbyCID(areaNo, classNO,propList, SerachKey, sprice, eprice,pageSize, currentPageIndex, orderCol, orderType, out totalPages, out totalCount);
         
        }
        /// <summary>
        /// 根据地区、商品类型获取商品
        /// </summary>
        /// <param name="entity">排序实体</param>
        /// <param name="areaNo">地区</param>
        /// <param name="parentClassID">商品父类型</param>
        /// <param name="orderCol">排序字段</param>
        /// <param name="orderType">排序方式</param>
        /// <param name="totalPages">总页数</param>
        /// <param name="totalCount">总条数</param>
        /// <returns></returns>
        public DataTable GetGoodsbyPID(string areaNo, int parentClassID, int pageSize, int currentPageIndex, EnumGoodOrder orderCol, EnumOrderType orderType, out int totalPages, out int totalCount)
        {
            T101_GoodsBLLSub bll = new T101_GoodsBLLSub();
            return bll.GetGoodsbyPID(areaNo, parentClassID, pageSize, currentPageIndex, orderCol, orderType, out totalPages, out totalCount);

        }
       
        /// <summary>
        /// 某店铺某类型商品
        /// </summary>
        /// <param name="entity">排序实体</param>
        /// <param name="shopID">店铺</param>
        /// <param name="classID">商品类型</param>
        /// <param name="orderCol">排序字段</param>
        /// <param name="orderType">排序方式</param>
        /// <param name="totalPages">总页数</param>
        /// <param name="totalCount">总条数</param>
        /// <returns></returns>
        public DataTable GetGoodsbyCID(int shopID, string classNO, int pageSize, int currentPageIndex, EnumGoodOrder orderCol, EnumOrderType orderType, out int totalPages, out int totalCount)
        {

            T101_GoodsBLLSub bll = new T101_GoodsBLLSub();
            return bll.GetGoodsbyCID(shopID, classNO, pageSize, currentPageIndex, orderCol, orderType, out totalPages, out totalCount);

        }
        /// <summary>
        /// 某店铺某父类型商品
        /// </summary>
        /// <param name="entity">排序实体</param>
        /// <param name="shopID">店铺</param>
        /// <param name="parentClassID">商品父类型</param>
        /// <param name="orderCol">排序字段</param>
        /// <param name="orderType">排序方式</param>
        /// <param name="totalPages">总页数</param>
        /// <param name="totalCount">总条数</param>
        /// <returns></returns>
        public DataTable GetGoodsbyPID(int shopID, int parentClassID, int pageSize, int currentPageIndex, EnumGoodOrder orderCol, EnumOrderType orderType, out int totalPages, out int totalCount)
        {
            T101_GoodsBLLSub bll = new T101_GoodsBLLSub();
            return bll.GetGoodsbyPID(shopID, parentClassID, pageSize, currentPageIndex, orderCol, orderType, out totalPages, out totalCount);

        }
        #endregion
        #endregion
        #region 商品浏览记录
        /// <summary>
        /// 添加商品浏览记录
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public bool AddGoodCheakInfo(T108_GoodCheakInfoEntity entity)
        {
            T108_GoodCheakInfoBLLSub bll = new T108_GoodCheakInfoBLLSub();

            return bll.AddGoodCheakInfo(entity);
        }
        
        #endregion

        #region 推荐商品
        /// <summary>
        /// 根据商品ID，获取浏览过这个商品的人浏览过的其他商品
        /// </summary>
        /// <param name="gID"></param>
        /// <param name="count"></param>
        /// <returns></returns>
        public DataTable GetRecommendGoods(int gID, int count)
        {
            T101_GoodsBLLSub bll = new T101_GoodsBLLSub();
            return bll.GetRecommendGoods("",gID, count);
        }
        /// <summary>
        /// 根据商品ID，获取浏览过这个商品的人浏览过的其他商品
        /// </summary>
        /// <param name="gID"></param>
        /// <param name="count"></param>
        /// <returns></returns>
        public DataTable GetRecommendGoods(int gID, int shopID, int count)
        {
            T101_GoodsBLLSub bll = new T101_GoodsBLLSub();
            return bll.GetRecommendGoods(gID, shopID, count);
        }
        #endregion

        #region 商品库存
        public T103_Goods_ItemEntity GetProductItem(string gNo, string colorNO, string sizeNO)
        {
            T103_Goods_ItemBLLSub bll = new T103_Goods_ItemBLLSub();
            return bll.GetObject(gNo, colorNO, sizeNO);
        }
        public List<T103_Goods_ItemEntity> getProductColorListByGNO(string gNo)
        {
            T103_Goods_ItemBLLSub bll = new T103_Goods_ItemBLLSub();
            return bll.getColorByGNO(gNo);
        }
        public List<T103_Goods_ItemEntity> getProductSizeListByGNO(string gNo)
        {
            T103_Goods_ItemBLLSub bll = new T103_Goods_ItemBLLSub();
            return bll.getSizeByGNO(gNo);
        }
        public T103_Goods_ItemEntity getProductItemInfo(int itemID)
        {
            T103_Goods_ItemBLLSub bll = new T103_Goods_ItemBLLSub();
            return bll.GetObjectByID(itemID);
        }
        #endregion

        #region 商品图片
        /// <summary>
        /// 商品详情图片
        /// </summary>
        /// <param name="gNo"></param>
        /// <returns></returns>
        public List<T104_GoodImgesEntity> GetProductInfoImg(string gNo)
        {
            T104_GoodImgesBLLSub bll = new T104_GoodImgesBLLSub();
          return  bll.GetProductInfoImg(gNo);
        }

        #endregion

        #region 商品属性值
        /// <summary>
        /// 获取商品属性值
        /// </summary>
        /// <param name="gNo"></param>
        /// <returns></returns>
        public DataTable GetProdoudProp(string gNo)
        {
            T113_Good_PropertyBLLSub bll = new T113_Good_PropertyBLLSub();
            return bll.GetProdoudProp(gNo);
        }
          /// <summary>
        /// 获取商品品牌
        /// </summary>
        /// <param name="gNo"></param>
        /// <returns></returns>
        public DataTable GetProdoudBrand(string gNo)
        {
            T113_Good_PropertyBLLSub bll = new T113_Good_PropertyBLLSub();
            return bll.GetProdoudBrand(gNo);
        }
        #endregion
    }
}
